package com.wantong.voice.webrtc;

/**
 * AutomaticGainControlUtils
 *
 * @author : stan
 * @version : 1.0
 * @date :  2021/10/08 12:05
 **/
public class AutomaticGainControlUtils {
    static {
        String libPath = System.getProperty("user.dir") ;
        System.load(libPath + "/native_lib/liblegacy_agc-lib.so");
        System.out.println("load legacy_agc-lib success");
    }

    public native long agcCreate();

    public native int agcFree(long agcInst);

    public native int agcInit(long agcInst, int minLevel, int maxLevel, int agcMode, int fs);

    public native int agcSetConfig(long agcInst, short targetLevelDbfs, short compressionGaindB, boolean limiterEnable);

    public native int agcProcess(long agcInst, short[] inNear, int num_bands, int samples, short[] out,
                                 int inMicLevel, int outMicLevel, int echo, boolean saturationWarning);

    public native int agcAddFarend(long agcInst, short[] inFar, int samples);

    public native int agcAddMic(long agcInst, short[] inMic, int num_bands, int samples);

    public native int agcVirtualMic(long agcInst, short[] inMic, int num_bands, int samples, int micLevelIn, int micLevelOut);
}
